package com.web.wps.logic.repository;

import com.web.wps.base.BaseRepository;
import com.web.wps.logic.entity.UserAclEntity;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserAclRepository extends BaseRepository<UserAclEntity, Long> {

    UserAclEntity findFirstByFileIdAndUserId(String fileId, String userId);

    @Query(value = "SELECT id FROM w_user_acl_t  WHERE file_id =?1 and user_id =?2 and permission = 'write'",nativeQuery = true)
    List<String> getUserAcl(String fileId, String userId);
}
